<div>
    <fieldset>
        <legend>Выдача</legend>

        <input type="hidden" id="order_id" value="<?php echo $this->data['order_id']; ?>"/>

        <span class="ErrorMessage" data-field="log"></span>


        <table><tbody>
            <tr><td>Номер экземпляра:</td><td><input type="text" id="item_id"
                value="<?php echo $this->data['item_id']; ?>"/></td></tr>
            <tr><td></td><td class="ErrorMessage" data-field="item_id"></td></tr>

            <tr><td>Дата выдачи:</td><td><input type="text" id="iss_date"
                value="<?php echo date('d.m.Y', time()); ?>"/></td></tr>
            <tr><td></td><td class="ErrorMessage" data-field="iss_date"></td></tr>

            <tr><td>Дата возврата:</td><td><input type="text" id="ret_date"/></td></tr>
            <tr><td></td><td class="ErrorMessage" data-field="ret_date"></td></tr>
        </tbody></table>

    </fieldset>

    <div class="ControlPanel">
        <button id="ApplyIssue">OK</button>
        <button id="CancelIssue">Отмена</button>
    </div>

    <script type="text/javascript">
        jsun.run(function() {
        //////////////////////////////////////////////////////

        jsun('#ApplyIssue').jsun.event({ onclick: ApplyIssue});
        jsun('#CancelIssue').jsun.event({ onclick: CloseDialog });

        function ApplyIssue() {
            var param = 'u=Edition/IssueItem' + jsun.page.get_data();

            jsun.json.load(function(p){
                if (p.STAT == 'OK') {

                    jsun.json.load(function(p) {
                        var div = jsun('#ReaderOrders');
                        div.innerHTML = "";
                        div.appendChild(jsun.dom.from_json(p));
                    }, 'u=Lib&m=Lib\\Reader/OrderList&user_id=' + jsun('#ReaderId').value);


                    jsun.json.load(function(p) {
                        var div = jsun('#ReaderIssues');
                        div.innerHTML = "";
                        div.appendChild(jsun.dom.from_json(p));
                    }, 'u=Lib&m=Lib\\Reader/IssueList&user_id=' + jsun('#ReaderId').value);

                    CloseDialog();
                } else {
                    jsun.show_err(p);
                }
            }, param);
        }

        function CloseDialog() {
            jsun.dialog.active.close();
        }

        //////////////////////////////////////////////////////
        });
    </script>
</div>